package com.springboot.study.config;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;

@Configuration
public class SwaggerConfig {

    @Value("${server.port}")
    private String serverPort;
    @Bean
    public OpenAPI springBootOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Swagger 3.0 文档"))
                .servers(List.of(new Server().url("http://localhost:" + serverPort).description("本地环境")))
                .externalDocs(new ExternalDocumentation());
    }
}
